Learn Node.js by Building 6 Projects: Build six practical and instructive Node.js projects by Eduonix Learning Solution Pvt. Ltd

Learn Node.js by Building 6 Projects: Build six practical and instructive Node.js projects by Eduonix Learning Solution Pvt. Ltd

Author:Eduonix Learning Solution Pvt. Ltd
Language: eng
Format: epub
Tags: COM060160 - COMPUTERS / Web / Web Programming, COM060180 - COMPUTERS / Web / Web Services and APIs, COM051260 - COMPUTERS / Programming Languages / JavaScript
Publisher: Packt Publishing
Published: 2018-03-30T09:29:41+00:00


Now let's go back to posts route, and we want to put the code in the get method we're getting the add form. So let's go in the router.get method and create a variable called categories. We'll set that to db.get('categories'), and then, we'll do a find on these categories. We will pass in empty curly braces, and the third parameter will be function. We'll take this render, cut it, and put it inside the categories; this way we can actually include our categories:

router.get('/add', function(req, res, next) {

var categories = db.get('categories');



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.